package com.zhh.front.view.center;

import com.zhh.api.model.RechargeRecord;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.math.BigDecimal;

public class RechargeResultView {
    private Integer id;
    private String result = "未知"; //充值结果
    private BigDecimal rechargeMoney; //充值金额
    private String rechargeDate = "-"; //充值时间

    public RechargeResultView(RechargeRecord record) {
        this.id = record.getUid();
        this.rechargeMoney = record.getRechargeMoney();//充值金额
        if(record.getRechargeTime() != null){
            rechargeDate = DateFormatUtils.format(record.getRechargeTime(),"yyyy-MM-dd");//充值时间
        }
        switch(record.getRechargeStatus()){//充值结果
            case 0:
                result = "充值中";
                break;
            case 1:
                result = "成功";
                break;
            case 2:
                result = "失败";

        }
    }

    public Integer getId() {
        return id;
    }

    public String getResult() {
        return result;
    }

    public String getRechargeDate() {
        return rechargeDate;
    }

    public BigDecimal getRechargeMoney() {
        return rechargeMoney;
    }
}
